﻿using System;
using System.Web;
using System.Web.SessionState;
using MasApp.BLL;

/// <summary>
///LoginBasePage 用于登录验证的 System.Web.UI.Page
/// </summary>
public class LoginBasePage : System.Web.UI.Page
{
    protected static string login_page = "~/default.html";
    public LoginBasePage()
    {
        this.Load += new EventHandler(LoginBasePage_Load);
    }

    void LoginBasePage_Load(object sender, EventArgs e)
    {
        //是否登录判断
        if (!LoginBasePage.hasLogin(this.Session))
        {
            Response.Redirect(login_page);
        }
        //app.BLL.response.alert("您已经登录，请先退出再重新登录！", "public/roleman.aspx");
        Page.EnableViewState = false;
    }
    /// <summary>
    /// 检查登录状态
    /// </summary>
    /// <returns></returns>
    public static bool hasLogin(HttpSessionState session)
    {
        return SessUtil.existSessionKey(session, "username");
    }
}
